package architecture;

//Registers
public class Registers{
	private int reg[]=new int[32];
	MyInt read_register1;
	MyInt read_register2;
	MyInt write_register;
	MyInt write_data;
	MyInt read_data1;
	MyInt read_data2;
	MyInt regWrite;
	public int [] getRegisters(){
		return reg;
	}
	void clockEvent(){
		switch(regWrite.i){
		case 0:
			break;
		case 1:
			reg[write_register.i]=write_data.i;
			break;
		}
		read_data1.i=reg[read_register1.i];
		read_data2.i=reg[read_register2.i];
	}
	void dump(){
		System.out.println("--------");
		System.out.println("Registers:");
		System.out.println("read_register1:"+read_register1);
		System.out.println("read_register2:"+read_register2);
		System.out.println("write_register:"+write_register);
		System.out.println("write_data:"+write_data);
		System.out.println("read_data1:"+read_data1);
		System.out.println("read_data2:"+read_data2);
		System.out.println("regWrite:"+regWrite);
		System.out.println("--------");
	}
}